/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package utn.frsf.cidisi.upcolbpip.interactionprotocols.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import utn.frsf.cidisi.upcolbpip.interactionprotocols.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class InteractionprotocolsFactoryImpl extends EFactoryImpl implements InteractionprotocolsFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static InteractionprotocolsFactory init() {
		try {
			InteractionprotocolsFactory theInteractionprotocolsFactory = (InteractionprotocolsFactory)EPackage.Registry.INSTANCE.getEFactory("utn.frsf.cidisi.upcolbpip.interactionprotocols"); 
			if (theInteractionprotocolsFactory != null) {
				return theInteractionprotocolsFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new InteractionprotocolsFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionprotocolsFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case InteractionprotocolsPackage.BUSINESS_MESSAGE: return createBusinessMessage();
			case InteractionprotocolsPackage.INTERACTION_PROTOCOL: return createInteractionProtocol();
			case InteractionprotocolsPackage.CONTROL_FLOW_SEGMENT: return createControlFlowSegment();
			case InteractionprotocolsPackage.INTERACTION_PATH: return createInteractionPath();
			case InteractionprotocolsPackage.LIFELINE: return createLifeline();
			case InteractionprotocolsPackage.TERMINATION: return createTermination();
			case InteractionprotocolsPackage.CONDITION: return createCondition();
			case InteractionprotocolsPackage.TIME_CONSTRAINT: return createTimeConstraint();
			case InteractionprotocolsPackage.TIME_OBSERVATION: return createTimeObservation();
			case InteractionprotocolsPackage.PROTOCOL_REFERENCE: return createProtocolReference();
			case InteractionprotocolsPackage.CORRELATION: return createCorrelation();
			case InteractionprotocolsPackage.ROLE: return createRole();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case InteractionprotocolsPackage.CONTROL_FLOW_OPERATOR:
				return createControlFlowOperatorFromString(eDataType, initialValue);
			case InteractionprotocolsPackage.TERMINATION_ELEMENT:
				return createTerminationElementFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case InteractionprotocolsPackage.CONTROL_FLOW_OPERATOR:
				return convertControlFlowOperatorToString(eDataType, instanceValue);
			case InteractionprotocolsPackage.TERMINATION_ELEMENT:
				return convertTerminationElementToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessMessage createBusinessMessage() {
		BusinessMessageImpl businessMessage = new BusinessMessageImpl();
		return businessMessage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionProtocol createInteractionProtocol() {
		InteractionProtocolImpl interactionProtocol = new InteractionProtocolImpl();
		return interactionProtocol;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ControlFlowSegment createControlFlowSegment() {
		ControlFlowSegmentImpl controlFlowSegment = new ControlFlowSegmentImpl();
		return controlFlowSegment;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionPath createInteractionPath() {
		InteractionPathImpl interactionPath = new InteractionPathImpl();
		return interactionPath;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Lifeline createLifeline() {
		LifelineImpl lifeline = new LifelineImpl();
		return lifeline;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Termination createTermination() {
		TerminationImpl termination = new TerminationImpl();
		return termination;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Condition createCondition() {
		ConditionImpl condition = new ConditionImpl();
		return condition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TimeConstraint createTimeConstraint() {
		TimeConstraintImpl timeConstraint = new TimeConstraintImpl();
		return timeConstraint;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TimeObservation createTimeObservation() {
		TimeObservationImpl timeObservation = new TimeObservationImpl();
		return timeObservation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProtocolReference createProtocolReference() {
		ProtocolReferenceImpl protocolReference = new ProtocolReferenceImpl();
		return protocolReference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Correlation createCorrelation() {
		CorrelationImpl correlation = new CorrelationImpl();
		return correlation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Role createRole() {
		RoleImpl role = new RoleImpl();
		return role;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ControlFlowOperator createControlFlowOperatorFromString(EDataType eDataType, String initialValue) {
		ControlFlowOperator result = ControlFlowOperator.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertControlFlowOperatorToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TerminationElement createTerminationElementFromString(EDataType eDataType, String initialValue) {
		TerminationElement result = TerminationElement.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTerminationElementToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionprotocolsPackage getInteractionprotocolsPackage() {
		return (InteractionprotocolsPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static InteractionprotocolsPackage getPackage() {
		return InteractionprotocolsPackage.eINSTANCE;
	}

} //InteractionprotocolsFactoryImpl
